import type {ActionType, ProColumns, ProDescriptionsItemProps} from '@ant-design/pro-components';
import {
    PageContainer,
    ProTable,
} from '@ant-design/pro-components';
import {Modal} from 'antd';
import React, {useRef, useState} from 'react';
import type {OperateLogListItem} from './data';
import {
    operateLogList,
} from './service';

const OperateLogList: React.FC = () => {
    const actionRef = useRef<ActionType>();

    /** 国际化配置 */
    const columns: ProColumns<OperateLogListItem>[] = [
        {
            title: '组织名称',
            dataIndex: 'organizationName',
            search: false,
            hidden: false,
        },
        {
            title: '资源类型',
            dataIndex: 'resourceType',
        },
        {
            title: '资源ID',
            dataIndex: 'resourceId',
            search: false,
        },
        {
            title: '账号',
            dataIndex: 'account',
            search: false,
        },
        {
            title: '显示名',
            dataIndex: 'username',
        },
        {
            title: '操作内容',
            dataIndex: 'content',
            search: false,
        },
        {
            title: '操作时间',
            dataIndex: 'createdAt',
            search: false,
        },
    ];

    return (
        <PageContainer>
            <ProTable<OperateLogListItem, API.ListPagination>
                headerTitle="操作日志"
                actionRef={actionRef}
                rowKey="id"
                search={{
                    labelWidth: 90,
                    span: 7,
                }}
                toolBarRender={() => []}
                request={operateLogList}
                columns={columns}
                rowSelection={false}
            />
        </PageContainer>
    );
};

export default OperateLogList;
